/**
 * Created by dywu on 2015/9/24.
 */
angular.module('preferential.service.user', ['ngResource'])

    //county
    .service('UserService', ['$resource', function ($resource) {
        //var resource = $resource(authurl + "user");
        var resource = $resource(activityURL + "CoupontemplateAll");
        //通过name,获取good
      /*  this.getuserbyid = function (id) {
            return resource.get({id: id});
        }
        this.getuserbyname = function (name,success,error) {
            var resource = $resource(authurl + "user/byname/:name");
            return resource.get({name:name},success,error);
        }
        this.add = function (user,success,error) {
             var resource = $resource(authurl + "user/add/:id");
            return resource.save({},user,success,error);
        }
        this.update = function (id,user,success,error) {
            return resource.save({id:id},user,success,error);
        }
        this.remove = function (id) {
            return resource.remove({id:id});
        }
        this.getlist = function () {
            return resource.query();
        }*/

        this.updatacoupontemplateall=function(upontemplateall,success,error){
            return resource.save(upontemplateall,success,error);
        }
        this.getcoupontemplateall = function (page,success) {
            return resource.query({pageIndex:page.pageIndex,pageSize:page.pageSize},success);
        }
        this.remove = function (upontemplateallid) {
            var resource = $resource(activityURL + "CoupontemplateAll/:coupontemplate");
            return resource.remove({coupontemplate:upontemplateallid});
        }
        this.getcoupontemplatebyid = function (upontemplateallid) {
            var resource = $resource(activityURL + "CoupontemplateAll/:coupontemplate");
            return resource.get({coupontemplate: upontemplateallid});
        }
        this.update = function (coupontemplate,success,error) {
            var resource = $resource(activityURL + "Coupontemplate/condition/:coupontemplate");
            return resource.save({coupontemplate:coupontemplate.coupontemplateid},coupontemplate,success,error);
        }


    }])
;